/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ifs.RnD.Graph;

import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Component;
import java.awt.Graphics;
import java.awt.Graphics2D;
import javax.swing.Icon;

/**
 *
 * @author AMIPLK
 */
public class Oval implements Icon {

    Color customColor;
    private int width, height;

    /**
     * @param wid
     * @param ht
     * @param type
     */
    public Oval(int wid, int ht, int type) {
        if (type == 1) {
            customColor = new Color(102, 204, 255);
        } else if (type == 0) {
            customColor = new Color(238, 213, 183);
        } else if (type == 2) {
            customColor = new Color(255, 204, 102);
        } else if (type == 3) {
            customColor = new Color(255, 204, 102);
        } else if (type == 4) {

            customColor = new Color(153, 255, 102);

        } else if (type == 5) {

            customColor = new Color(153, 102, 255);

        } else if (type == 6) {

            customColor = new Color(153, 102, 255);

        } else if (type == 7) {

            customColor = new Color(153, 102, 255);

        } else if (type == 8) {

            customColor = new Color(153, 0, 51);

        } else if (type == 9) {

            customColor = new Color(147, 112, 219);

        } else {
            customColor = new Color(110, 123, 139);
        }
        width = wid;
        height = ht;


    }

    /**
     * draw oval and set a color
     * @param container 
     * @param g 
     * @param q
     * @param p  
     */
    public void paintIcon(Component container, Graphics g,
            int p, int q) {

        Graphics2D g2 = (Graphics2D) g;
        double x = 15, y = 50, w = 70, h = 70;
        g2.setPaint(Color.black);
        g2.setStroke(new BasicStroke(1.5f, 2, 1));
        g2.setColor(customColor);
        g2.fillOval(q, q, width, height);
        g2.setColor(Color.BLACK);
        g2.drawOval(q, q, width - 1, height - 1);


    }

    /**
     *
     * @return
     */
    public int getIconWidth() {
        return width;
    }

    /**
     *
     * @return
     */
    public int getIconHeight() {
        return height;
    }
}
